//
//  AgentDetailHeaderView.m
//  BaseProject
//
//  Created by 王洋 on 2021/3/2.
//  Copyright © 2021 王洋. All rights reserved.
//

#import "AgentDetailHeaderView.h"

@implementation AgentDetailHeaderView

- (void)awakeFromNib {
    [super awakeFromNib];

    self.bgView.layer.cornerRadius  = 5;
    self.bgView.layer.masksToBounds = NO;
    
    self.bgView.layer.shadowColor   = UIColorHex(0xff4242).CGColor;
    self.bgView.layer.shadowOffset  = CGSizeMake(0, 1);
    self.bgView.layer.shadowOpacity = 0.6;
    self.bgView.layer.shadowRadius  = 6;
    
    [self.recCodeControl addGestureTapEventHandle:^(id  _Nonnull sender, UITapGestureRecognizer * _Nonnull gestureRecognizer) {
       
        if (self.AgentDetailHeaderViewBlock) {
            self.AgentDetailHeaderViewBlock();
        }
    }];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
        [self.recCodeControl pp_clipCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft radius:self.recCodeControl.frame.size.height/2];
        
        [self.bgImageView pp_clipCorners:UIRectCornerAllCorners radius:5];

    });
}

- (void)fillWithModel:(UserBalanceInfoModel *)model {
    self.freezeLab.text =[NSString stringWithFormat:@"可用资金¥%@",[Utilities changeDoubleToString:model.availableAmount]];
    self.totalLab.text = [NSString stringWithFormat:@"¥%@",[Utilities changeDoubleToString:model.totalAmount]];
}

- (void)scrollViewDidScroll:(CGFloat)contentOffsetY {
//    CGRect frame = self.imageViewFrame;
//    frame.size.height -= contentOffsetY;
//    frame.origin.y = contentOffsetY;
//    self.imageView.frame = frame;
}

@end
